home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / eulisp / feel0_89.lha / Feel / Src / i860-diffs < prev    next >
Text File  |  1992-06-05  |  4KB  |  196 lines

  1. *** system.c    Tue Feb 11 20:12:41 1992
  2. --- ../system.c    Tue Mar 24 14:11:30 1992
  3. ***************
  4. *** 353,360 ****
  5. --- 353,433 ----
  6.   int shared_ids[MAX_SHARED_SEGMENTS];
  7.   int shared_segment_count;
  8.   
  9. + #if 1
  10. + #include <errno.h>
  11. + #define MAX_SHARED_PAGE_SZ 1024*1024
  12. + #define PAGE_BOUNDARY 4096
  13.   char *system_malloc(int n)
  14.   {
  15. +   char *alloc_memory_block(int size);
  16. +   char *addr=0;
  17. +   int k=0;
  18. +   int left=n;
  19. +   if (n==0)
  20. +     return NULL;
  21. +   while (left > MAX_SHARED_PAGE_SZ || addr==0)
  22. +     {
  23. +       if (addr==0)
  24. +     addr=alloc_memory_block(MAX_SHARED_PAGE_SZ);
  25. +       else 
  26. +     alloc_memory_block(MAX_SHARED_PAGE_SZ);
  27. +       left -=MAX_SHARED_PAGE_SZ;
  28. +     }
  29. +   if (left>0)
  30. +     alloc_memory_block(left);
  31. +   return addr;
  32. + }
  33. + char *alloc_memory_block(int size)
  34. + {
  35. +   static int id=0;
  36. +   char *addr;
  37. +   int res;
  38. +   if (id==0)
  39. +     id=25;
  40. +   printf("alloc: %d %d\n",id,size);
  41. +   if (size==0)
  42. +     return NULL;
  43. +   if ((size&4095))
  44. +     size=(size+4096)&(~4095);
  45. +   addr=sbrk(0);
  46. +   if (((int)addr&4095))
  47. +     addr= (char *)(((int)addr+4096)&(~4095));
  48. +   if (brk(addr+size)==-1)
  49. +     perror("Brk");
  50. +   printf("allocating: %x,%x\n",addr,size);
  51. +   do
  52. +     {
  53. +       extern volatile int errno;
  54. +       errno=0;
  55. +       id++;
  56. +       res=create_shared_region(id,addr,size,0);
  57. +       if (res<0)
  58. +     perror("create");
  59. +     }
  60. +   while (res==-1 && errno==EINVAL);
  61. +   if (res== -1)
  62. +     perror("create");
  63. +   shared_ids[shared_segment_count] = id;
  64. +   ++shared_segment_count;  
  65. +   id++;
  66. +   
  67. +   return addr;
  68. + }
  69. + #else
  70. + char *system_malloc(int n)
  71. + {
  72.     int seg;
  73.     char *addr;
  74.   
  75. ***************
  76. *** 379,385 ****
  77.   
  78.     return(addr);
  79.   }
  80.   /* Of static shared bits (assumes serial for now)... */
  81.   
  82.   #define STATIC_MALLOC_HUNK_SIZE (4096)
  83. --- 452,458 ----
  84.   
  85.     return(addr);
  86.   }
  87. ! #endif
  88.   /* Of static shared bits (assumes serial for now)... */
  89.   
  90.   #define STATIC_MALLOC_HUNK_SIZE (4096)
  91. ***************
  92. *** 499,510 ****
  93.   
  94.     fprintf(stderr,"\n\nAborting EuLisp on signal %d... ",sig);
  95.   
  96.     for (i=0;i<shared_segment_count;++i) {
  97.       (void) shmctl(shared_ids[i],IPC_RMID,NULL);
  98.     }
  99. !   (void) semctl(system_semaphore,NULL,IPC_RMID,NULL);
  100.     /* Kill of other processes too */
  101.   
  102.     for (i=0; i<RUNNING_PROCESSORS(); ++i)
  103. --- 572,586 ----
  104.   
  105.     fprintf(stderr,"\n\nAborting EuLisp on signal %d... ",sig);
  106.   
  107. + #if 1
  108. +   for (i=0; i<shared_segment_count ; i++)
  109. +     delete_shared_region(shared_ids[i]);
  110. + #else
  111.     for (i=0;i<shared_segment_count;++i) {
  112.       (void) shmctl(shared_ids[i],IPC_RMID,NULL);
  113.     }
  114. ! #endif
  115.     /* Kill of other processes too */
  116.   
  117.     for (i=0; i<RUNNING_PROCESSORS(); ++i)
  118. ***************
  119. *** 522,535 ****
  120.   
  121.   void system_lisp_exit(int n)
  122.   {
  123. !   int i;
  124.     for (i=0;i<shared_segment_count;++i) {
  125.       (void) shmctl(shared_ids[i],IPC_RMID,NULL);
  126.     }
  127.     (void) semctl(system_semaphore,NULL,IPC_RMID,NULL);
  128.   
  129.     /* Kill of other processes too */
  130.   
  131.     for (i=0; i<RUNNING_PROCESSORS(); ++i)
  132. --- 598,614 ----
  133.   
  134.   void system_lisp_exit(int n)
  135.   {
  136. !    int i;
  137. ! #if 1
  138. !   for (i=0; i<shared_segment_count ; i++)
  139. !     delete_shared_region(shared_ids[i]);
  140. ! #else
  141.     for (i=0;i<shared_segment_count;++i) {
  142.       (void) shmctl(shared_ids[i],IPC_RMID,NULL);
  143.     }
  144.     (void) semctl(system_semaphore,NULL,IPC_RMID,NULL);
  145.   
  146. + #endif
  147.     /* Kill of other processes too */
  148.   
  149.     for (i=0; i<RUNNING_PROCESSORS(); ++i)
  150. ***************
  151. *** 591,597 ****
  152.         sigset(KICK_SIGNAL,system_nout);
  153.         (void) sighold(KICK_SIGNAL);
  154.   
  155. !       PROFILE(printf("PVAL:%x\n",PROFILE_TIME(system_local_timer)));
  156.         fflush(stdout);
  157.         return(error);
  158.       }
  159. --- 670,676 ----
  160.         sigset(KICK_SIGNAL,system_nout);
  161.         (void) sighold(KICK_SIGNAL);
  162.   
  163. !       /**PROFILE(printf("PVAL:%x\n",PROFILE_TIME(system_local_timer)));**/
  164.         fflush(stdout);
  165.         return(error);
  166.       }
  167. ***************
  168. *** 609,616 ****
  169.       if (i != system_scheduler_number)
  170.         kill(SYSTEM_GLOBAL_ARRAY1_VALUE(system_pids,i),KICK_SIGNAL);
  171.   }
  172. - DEF_PROFILE_TIMER(system_local_timer);
  173.   
  174.   void system_register_process(int n)
  175.   {
  176. --- 688,693 ----
  177.